package 集合.Map;

import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;

public class main {
    /**
     * 如果hashcode和equals方法相等，那么hashmap中就只有一个元素，因为hashmap的key是唯一的，所以value会覆盖掉。
     * person的hashcode和equals被重写了
     */
    public static void main(String[] args) {
        Person person1 = new Person("key1");

        Person person2 = new Person("key2");

        HashMap<Person, String> personStringHashMap = new HashMap<>();

        personStringHashMap.put(person1,"key1");
        personStringHashMap.put(person2,"key2");

        System.out.println(personStringHashMap.size());

        ConcurrentHashMap<Object, Object> objectObjectConcurrentHashMap = new ConcurrentHashMap<>();

        HashSet<Object> objects = new HashSet<>();
    }
}
